<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <img src="images/closed.png" alt="">
    <script>
        var img = document.querySelector('img');
        img.onclick = function() {
            if (img.src.match("images/closed.png")) {
                img.src = 'images/opened.png';
            } else {
                img.src = 'images/closed.png';
            }

        }
    </script>
</body>

</html>